<template>
	<view class="content" >	
		<uni-forms ref="form" :rules="rules" v-if="showForm&&formField.length>0" >
			
			<view v-for="(item,index) in formField" :key="index">
				<uni-forms-item v-if="item.field_type=='text'"  :label="item.title" :name="item.name">
					<uni-easyinput :type="item.field_type" v-model="formData[item.name]" :placeholder="'请输入'+item.title"  clearable="false"/>
				</uni-forms-item>
				
				<uni-forms-item v-if="item.field_type=='picker'" :label="item.title" :name="item.name">
					<view class="form_item_input">
						<picker @change="selectChange" :data-key="item.name"  :value="picker[item.name]['index']" :range="item.data_list" :range-key="'name'">
							<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{item.data_list[picker[item.name]['index']].name}}</view>
						</picker>
					</view>
				</uni-forms-item>
				
				
				<uni-forms-item v-if="item.field_type=='checkbox'" :label="item.title" :name="item.name">
					<uni-data-checkbox  selectedColor="#910a15" v-model="formData[item.name]" :localdata="checkMap[item.name]"></uni-data-checkbox>
				</uni-forms-item>
			</view>
				

			<uni-forms-item label="用户协议:" name="agree" >
				<view class="agree_top"><uni-data-checkbox  selectedColor="#3a3a3a" v-model="agreeChecked"  :localdata="agree"></uni-data-checkbox></view>
				<view class="agree_bottom">点击<text @click="agreeClick">《用户隐私保障协议》</text>查看</view>
			</uni-forms-item>
			
			
			<view style="margin-bottom: 80rpx;margin-top: 30rpx;">
				<button type="default" class="button" style="background-color: #910a15;color: #fff; font-size: 30rpx;" @click="submitForm('form')">提交</button>				
			</view>
			<app-agree :show.sync="showAgree"></app-agree>

		</uni-forms>
		
		<u-modal :show="showCodeBox" confirmColor="#910a15"  title="请填写工号" :closeOnClickOverlay="true" @confirm="confirmCode">
			<view class="slot-content">
				<u--input placeholder="请输入工号" border="surround" v-model="formData.user_code" ></u--input>
			</view>
		</u-modal>
		
		
		<u-modal :show="showAccount" confirmColor="#910a15"  title="请选择账套" :closeOnClickOverlay="true" @confirm="confirmAccount">
			<view class="slot-content">
				
				<view v-for="(item,index) in formField" :key="index">
					
					<view v-if="item.name=='account_num'" class="form_item_input"  style="width: 350rpx;">
						<picker @change="selectChange" :data-key="item.name"  :value="picker[item.name]['index']" :range="item.data_list" :range-key="'name'">
							<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{item.data_list[picker[item.name]['index']].name}}</view>
						</picker>
					</view>
					
				</view>
				
			</view>
		</u-modal>
		
	</view>
</template>

<script>
	import {index} from './index.js';
	export default {mixins: [index]}
</script>

<style>
	@import './index.css';
</style>
